<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> 

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>



        <div class="container">
<a href="${pageContext.request.contextPath}/"><h1><img src="${pageContext.request.contextPath}/tooth-icon.png">Gabinet stomatologiczny</h1></a>
            <div class="navbar">
                <div class="navbar-inner">
                    <div class="container">                        
                    
                        <!-- menu -->
                        <ul class="nav">
                            <li><a href="${pageContext.request.contextPath}/">Start</a></li>
                            <li><a href="${pageContext.request.contextPath}/about">O nas</a></li>
                            <li><a href="${pageContext.request.contextPath}/offer">Oferta</a></li>
                            <li><a href="${pageContext.request.contextPath}/prices">Cennik</a></li>
                            <li><a href="${pageContext.request.contextPath}/gallery">Galeria</a></li>
                            <li><a href="${pageContext.request.contextPath}/contact">Kontakt</a></li>
                        </ul>
                        <!-- menu koniec -->
                        
                        <!-- pasek logowania -->
                        <c:if test="${pageContext.request.userPrincipal.name == null}">
                            <form class="navbar-form pull-right">
                                <ul class="nav">

                                    <li><a href="${pageContext.request.contextPath}/login">Zaloguj się</a></li>
                                    <li><a href="${pageContext.request.contextPath}/new-account">Załóż konto</a></li>

                                </ul>
                            </form>
                        </c:if>
                        
                        <!-- pasek logowania koniec -->
                        <!-- ZALOGOWANY -->
                        <c:if test="${pageContext.request.userPrincipal.name != null}">
                            <form class="navbar-form pull-right">
                                <ul class="nav">
             
                                   <sec:authorize ifAnyGranted='ROLE_ADMIN'> 	    
                                    <li><a href="${pageContext.request.contextPath}/admin">Panel administratora</a></li>
                                   </sec:authorize>
                                    <sec:authorize ifAnyGranted='ROLE_USER_P'> 	    
                                    <li><a href="${pageContext.request.contextPath}/">Rejestracja wizyty</a></li>
                                    <li><a href="${pageContext.request.contextPath}/">Historia wizyt</a></li>
                                   </sec:authorize>
                                    <sec:authorize ifAnyGranted='ROLE_USER_D'> 	    
                                    <li><a href="${pageContext.request.contextPath}/">Pacjenci</a></li>
                                    <li><a href="${pageContext.request.contextPath}/">Grafik</a></li>
                                    </sec:authorize>
                                   <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">${pageContext.request.userPrincipal.name} <b class="caret"></b></a>
                                    <ul class="dropdown-menu">
                                       <li><a href="javascript:formSubmit()">Mój profil</a></li>
                                      <li><a href="javascript:formSubmit()">Wyloguj</a></li>
                                      
                                    </ul>
                                  </li>
                                   
                                            
                                            

                                </ul>
                            </form>
                        </c:if>
                        
                        <!-- ZALOGOWANY KONIEC -->
                        
                        <c:url value="/j_spring_security_logout" var="logoutUrl" />
                            <form action="${logoutUrl}" method="post" id="logoutForm">
                                <input type="hidden" name="${_csrf.parameterName}"
                                value="${_csrf.token}" />
                            </form>
                            <script>
                                function formSubmit() {
                                    document.getElementById("logoutForm").submit();
                                }
                            </script>
                        
                      
                        
                    </div>
                    
                </div>
            </div>